{% extends "base.html" %}
{% block header_js %}
<script language="javascript" type="text/javascript" src="/static/js/date/WdatePicker.js"></script>
<script type="text/javascript" src="/static/js/validation.js"></script>
<script type="text/javascript" src="/static/js/jquery.treeview.js"></script>
<script type="text/javascript" src="/static/js/jquery.cookie.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
    });

    function loadModel(){
        var id = $('#model').val();
        if(id == '--') {
            alert("请选择机器类型");
            return false;
        }
        $.get('/host/ajax_get_model', {"id": id}, function(data){
            $("#model_info").html(data);
        });
    }

    function loadGroup(){
        var id = $('#group').val();
        if(id == '--') {
            alert("请选择报警组");
            return false;
        }
        $.get('/host/ajax_get_group', {"id": id}, function(data){
            $("#group_info").html(data);
        });
    }

    function loadStra(){
        var id = $('#stra').val();
        if(id == '--') {
            alert("请选择策略组");
            return false;
        }
        $.get('/host/ajax_get_stra', {"id": id}, function(data){
            $("#stra_info").html(data);
        });
    }

    function addline(){
    var line = "<div class='row'><label>克隆主机:</label>";
    line += "<span>名字:</span><input  type='text' name='cname' class='word_in boxinput'/>";
    line += "<span>IP:</span><input  type='text' name='cip' class='word_in boxinput'/>";
    line += "<a class='new_zeng' href='javascript:addline()' style='float:left'>新增一行</a></div>";
    $("#host_rows").append(line);


    }

$(document).ready(function(){
	$("#browser").treeview();
});
</script>
{% endblock %}

<body>
{% block header %}
{% include "host-menu.html" %}
{% endblock %}

{% block content %}
<div class="wrap">
	<div class="wrap_right tree">
	{% autoescape off %}
	    {{ tree }}
	{% endautoescape %}
	</div>
    <div class="wrap_left right">
		<div class="shenqing1">
			<h5 style="float:left;width:96%;margin-bottom:10px;">克隆主机</h5>
		</div>
		<div class="caozuo_add">
		<form id="customForm" action="/host/clone/" method="post">
        <div class="box">
            <h2>主机</h2>
            <div class="row" style="display:none">
                <label class="">主机ID:</label>
                <input type="text" name="id" class="word_in boxinput" value="{{host.id}}" readonly="readonly"/>
            </div>
 
            <div class="row">
                <label class="">主机名字:</label>
                <input id="hostname" type="text" name="hostname" class="word_in boxinput" value="{{host.name}}" readonly="readonly" style="border:none;color:#484848;" />
            </div>
            <div class="row">
                <label>主机IP:</label>
                <input id="ip" type="text" name="ip" class="word_in boxinput"  value="{{host.ip}}" readonly="readonly" style="border:none;color:#484848;" />
            </div>
            
            <div class="row">
                <label>机房:</label>
                <input id="idc" type="text" name="idc" class="word_in boxinput"  value="{{host.idc}}" readonly="readonly" style="border:none;color:#484848;" />
            </div>
          
             <div class="row">
                <label>产品线:</label>
                <input id="product" type="text" name="product" class="word_in boxinput"  value="{{host.pid}}" readonly="readonly" style="border:none;color:#484848;" />
            </div>
          
            <div class="row">
                <label>上架时间:</label>
		        <input id="time" type="text" name="setup_time" class="word_in boxinput"  value="{{host.setup_time|date:'Y-m-d'}}" onClick="WdatePicker()" style="border:none;color:#484848;"/>
            </div>
          
            <div class="row">
                <label>机器型号:</label>
                <input id="hostmodel" type="text" name="hostmodel" class="word_in boxinput"  value="{{host.mid}}" readonly="readonly" style="border:none;color:#484848;"/>
            </div>
            <div id = "model_info"></div>
          
            <h2>策略绑定</h2>
            <div class="row">
                <label>策略组:</label>
                <input id="stra" type="text" name="stra" class="word_in boxinput"  value="{{hostalert.sid}}" readonly="readonly"  style="border:none;color:#484848;" />
            </div>
            <div id="stra_info" class="row"></div>

            <div class="row">
                <label>报警组:</label>
                <input id="group" type="text" name="group" class="word_in boxinput"  value="{{hostalert.gid}}" readonly="readonly" style="border:none;color:#484848;" />
            </div>    
            <div id="group_info" class="row"></div>
            <div id="host_rows">
             <div class="row">
                <label>克隆主机:</label>
                <span>名字:</span><input  type="text" name="cname" class="word_in boxinput"/>
                <span>IP:</span><input  type="text" name="cip" class="word_in boxinput"/>
                <a class="new_zeng" href="javascript:addline()" style="float:left">新增一行</a>
            </div>
            </div>

        </div>
	    <input type="submit" class="tijiao_big" value="&nbsp;&nbsp;提交" />
		</form>
		</div>
    </div>
</div>
{% endblock %}

</body>
</html>
